UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xB6fXkqPCRroL906QSru22ZIwuS3sWC30QuSsER98SU=' 
WHERE 
  key_id = '1d2dc9f31528944b0ade1b0eace32be7b43a418817ace781edb174a28010c06f' 
  AND (
    token = 'xB6fXkqPCRroL906QSru22ZIwuS3sWC30QuSsER98SU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033