UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BiK8hoxFLq/LxnhMp32QwA8mEZ8a+KCmC2H9YyCrUaA=' 
WHERE 
  key_id = 'fea94257d30ac1b34356c1e9452300993e08f4423d764e445274838187ae727a' 
  AND (
    token = 'BiK8hoxFLq/LxnhMp32QwA8mEZ8a+KCmC2H9YyCrUaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033