UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tBSdGy4i0SkaFNWm9s68yNkXqAx9At1GKWulPymOEHE=' 
WHERE 
  key_id = '965748500c9ab3ac288ca4a64a21433b63b58a8a1a0e57f5516403a09aae9ec1' 
  AND (
    token = 'tBSdGy4i0SkaFNWm9s68yNkXqAx9At1GKWulPymOEHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037