UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aT0dKjzKYVXF835x0fQf91pyIPPVLmpp6uByJT2Xbjg=' 
WHERE 
  key_id = '30ea6ca136f802779657591a7a19319c80a71cb6b9de037a9cc65ff503aace01' 
  AND (
    token = 'aT0dKjzKYVXF835x0fQf91pyIPPVLmpp6uByJT2Xbjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048