UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LQ3Jbm+2MpPAagC7KUVlUKBR079DWr6IRDsCMzv1uPo=' 
WHERE 
  key_id = '79be1fb1467df1cc9bc3aa6e144973ee09f50b072147cecfd78685e6f24f8eee' 
  AND (
    token = 'LQ3Jbm+2MpPAagC7KUVlUKBR079DWr6IRDsCMzv1uPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039