UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mey4grZc3c5NMfCdfWpA486tMFLTz74t9HJ3VzRGUlU=' 
WHERE 
  key_id = '3ed764e74571a40aa5c54b2d075e95cf42084cbf2fd6eb39a28fb9bdafb83b57' 
  AND (
    token = 'mey4grZc3c5NMfCdfWpA486tMFLTz74t9HJ3VzRGUlU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039