UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o2QGhE3FqH9exD579fz/Tvrhbou18Y2wmbTPVblQxns=' 
WHERE 
  key_id = '216b64b26a2e684342ef628e11036cc3179229fc9d300b2f6dfbd01472af16dc' 
  AND (
    token = 'o2QGhE3FqH9exD579fz/Tvrhbou18Y2wmbTPVblQxns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023