UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QoifDQsHkqWVxIFGFd5X65VVbkQIAOwG8YXXg1n3Cw0=' 
WHERE 
  key_id = '4f3e245c5a061201dcb05398fe82cf9b2031ec55482d3e98212d96a72d6c0d4f' 
  AND (
    token = 'QoifDQsHkqWVxIFGFd5X65VVbkQIAOwG8YXXg1n3Cw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027