UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gfPtB6n1MCLpaEF+t4MZiXD3uQ5K/9S7JHFg59pKP9c=' 
WHERE 
  key_id = '0f6e85ac824a2f118043348c08b25da631e905d608b32c161ef03583f1bf4a49' 
  AND (
    token = 'gfPtB6n1MCLpaEF+t4MZiXD3uQ5K/9S7JHFg59pKP9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032