UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F2QpzRwAez2YtaddWOMF9dNzgZchJ0zGN3rBev2teKk=' 
WHERE 
  key_id = '5674423d3a0234ff5a496fc2e395eb7f0a59aef61218570e94658710c761cd51' 
  AND (
    token = 'F2QpzRwAez2YtaddWOMF9dNzgZchJ0zGN3rBev2teKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036