UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C/qAka/VhiPtwCnzm0ucIK7MatwaYHR1udeDObbxnik=' 
WHERE 
  key_id = 'e48d68c1d3806b60cb811a533a96383513d2867607557395e0455bf05954890f' 
  AND (
    token = 'C/qAka/VhiPtwCnzm0ucIK7MatwaYHR1udeDObbxnik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015