UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kk7r4O1R+KIjMHK3xhNU+nKm3Zkq2qtWFBYy5RUdaUw=' 
WHERE 
  key_id = '18fd8cddb7cc9b4d3e42017781d2ff95a086aecb8f2ee40c7896826fc30220bf' 
  AND (
    token = 'kk7r4O1R+KIjMHK3xhNU+nKm3Zkq2qtWFBYy5RUdaUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023