UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HYc6JlLQTC8R4m91NabxN0UXTx7HKxfzTE9fsd2r4d4=' 
WHERE 
  key_id = '2ddeecb14446d4940080ab6c1cd2f388443c9ab360f29007ef8855c03643e37a' 
  AND (
    token = 'HYc6JlLQTC8R4m91NabxN0UXTx7HKxfzTE9fsd2r4d4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025