UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eeogj8BOdHeC+DFrr0gm1SPspgpT+G87cCgdh6UcV/Y=' 
WHERE 
  key_id = '6de4c6bd6ba9ec6c5394215a417401f60917f80a2854122d14e2eb6be8302a00' 
  AND (
    token = 'eeogj8BOdHeC+DFrr0gm1SPspgpT+G87cCgdh6UcV/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053