UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A2xhKcA7kaADiQx9j5zqvXqvGQnDI/bdqhd0xbXPX9Q=' 
WHERE 
  key_id = '2d15042a125b4ff88489fc1fb8ca1b9e7bc61f20155d06de57dde43cec809ec5' 
  AND (
    token = 'A2xhKcA7kaADiQx9j5zqvXqvGQnDI/bdqhd0xbXPX9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052