UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kV2DMs5i16f5bJpKJSCF7QZwvyMmvFWj+dfzDs4OFic=' 
WHERE 
  key_id = '22e00665705a8eec6d9c46a7b5aff3305506febf12293b0a011a67978bbd8f48' 
  AND (
    token = 'kV2DMs5i16f5bJpKJSCF7QZwvyMmvFWj+dfzDs4OFic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038