UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lffl3gnHYL6s4z/M8KAJ85Mk3Y+CkKMIBaFODWAi9G0=' 
WHERE 
  key_id = '0a39e0ee722c0579300e22ba5aa7de9ff95250769f19d1b69462294dd7cf12b2' 
  AND (
    token = 'lffl3gnHYL6s4z/M8KAJ85Mk3Y+CkKMIBaFODWAi9G0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030