UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ecmWggj1OeH9G2v0Msv+Fjp+thri8W5yyKBia9WIfYo=' 
WHERE 
  key_id = '1cb76625bb046ecf7a486d60d912963d0296b09b8817544e0aea1baeb0a22bef' 
  AND (
    token = 'ecmWggj1OeH9G2v0Msv+Fjp+thri8W5yyKBia9WIfYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047