UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '47tFXowC6eNliBFxsWUSZZUf21FK+8fpkcgYw4h8eU4=' 
WHERE 
  key_id = '243d3cab9a02d9b241d8703cc0622f8f4d5f118cc046b21a5c4cfcd120b7152a' 
  AND (
    token = '47tFXowC6eNliBFxsWUSZZUf21FK+8fpkcgYw4h8eU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018