UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gVfqqNDU2XQWkH5xIRuSo/pFmf0nr0SMn6FAb2lz+io=' 
WHERE 
  key_id = '52535c3fd316ad2c464c2710d96fdd237b2b79a3425e8de9c57c8d8c7a01dc65' 
  AND (
    token = 'gVfqqNDU2XQWkH5xIRuSo/pFmf0nr0SMn6FAb2lz+io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039