UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k7FrUP2rbZow+rRWL3wxU8/CmVGLtJcIAxKMpRN0Awg=' 
WHERE 
  key_id = '0794ddd7e2ec75a479659c91b1808b3e1be9f612771dee76a44883376f5fbf7f' 
  AND (
    token = 'k7FrUP2rbZow+rRWL3wxU8/CmVGLtJcIAxKMpRN0Awg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030