UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZR6my1pznzf1qoEDpubIeiOXIvAXIa3qY/y0LOCD85Y=' 
WHERE 
  key_id = '38f180ec6805a456cc2acccb46afb5e99f43f1d796550ad9e06897ad575e5e79' 
  AND (
    token = 'ZR6my1pznzf1qoEDpubIeiOXIvAXIa3qY/y0LOCD85Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032