UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rRF6HHTMGQ1++R4hXqOVaGERd7jtKa/7TePblCWAP0c=' 
WHERE 
  key_id = '0616d3bef4bfebd5487d9184296bb10713d9e39296b9c7798151542053f39bf8' 
  AND (
    token = 'rRF6HHTMGQ1++R4hXqOVaGERd7jtKa/7TePblCWAP0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071