UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Osd0kTx44+bccMBsbqEaajVMHJLU5H6MTlkjIeOs9UM=' 
WHERE 
  key_id = '9a6a3c08ad24c4100afb2b344980ff7a9d408a9901ee3788a2495b76a2160e65' 
  AND (
    token = 'Osd0kTx44+bccMBsbqEaajVMHJLU5H6MTlkjIeOs9UM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029