UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lOwsH65BTxC1r4jr7kaYDtGZ3+OLc12vboKBpok+LXg=' 
WHERE 
  key_id = '163f39c6eb1f49e74d99bc6485f40acc56d0995e80acd2432cfe7e353b1018f2' 
  AND (
    token = 'lOwsH65BTxC1r4jr7kaYDtGZ3+OLc12vboKBpok+LXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040