UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6tPynztUc3ZpJbGvFmK3WevR1NVbSxEVgwDX+kaJcEY=' 
WHERE 
  key_id = '4ec707c2acbee08750d291b91353efdab97b924b5c9d8667f99dcdbbeb6e72ca' 
  AND (
    token = '6tPynztUc3ZpJbGvFmK3WevR1NVbSxEVgwDX+kaJcEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049