UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GkyY/wBCe5VBoXlbRuQk0C6R+vTxqF/DUX+wwm096WQ=' 
WHERE 
  key_id = '8c681ea4ec54ee010f483c2c3c29fe16af8262bb4baa4ff66f45188c99a06bee' 
  AND (
    token = 'GkyY/wBCe5VBoXlbRuQk0C6R+vTxqF/DUX+wwm096WQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044