UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'erIK7rZqUHj9RUur7uNheB88iqp51ZD2FkvJuQS0McQ=' 
WHERE 
  key_id = 'fa4d527ad2bf99bdde9a0ca2467be5111425ca8dc9b2d01d6bb9e3c20fa4f71e' 
  AND (
    token = 'erIK7rZqUHj9RUur7uNheB88iqp51ZD2FkvJuQS0McQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042