UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+TEuRnunwiy3crPrt3Wx11QL8vY+nsPwTCY1/RQ/FpI=' 
WHERE 
  key_id = 'fc83a3cbbf2a7eafbfa3d04018a489bd450a003874d7b68ebf290c943c9fe9c2' 
  AND (
    token = '+TEuRnunwiy3crPrt3Wx11QL8vY+nsPwTCY1/RQ/FpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038